<?php
//setlocale(LC_TIME, 'ca_ES', 'Catalan_Spain', 'Catalan');

// CANVIS
setlocale(LC_TIME, 'ca_ES.utf8');
$mysqli=new mysqli('localhost','root','madelaine','test');
if ($mysqli->connect_errno) {
    echo "Falló la conexión a MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}
$opts = $argv[1];
$valor=isset($_GET['v'])?$_GET['v']:(!empty($opts)?$opts:'No');


echo "AFEGIT: $valor --> ".strftime("%c")."<br>";
if (!$res=$mysqli->query("insert into taula(taula_valor) values('$valor')")) die('errrrrrroooooooorrrrrrr');

echo "--------------------------------";

if (!$res=$mysqli->query("SELECT * FROM taula")) die('errrrrrroooooooorrrrrrr');
while ($row=$res->fetch_assoc()) echo $row['taula_id'].' - '.$row['taula_creat'].' - '.$row['taula_valor'].'<br>';

?>

